package v1

import (
	"devops-super/api"
	"devops-super/internal/model/entity"
	"devops-super/internal/model/mymodel"

	"github.com/gogf/gf/v2/frame/g"
)

type ClusterServerPageLstReq struct {
	g.Meta `method:"get" path:"/cluster/server/page-list" summary:"分页获取集群服务器列表" tags:"集群服务器"`
	*api.PageLstReq
}

type ClusterServerPageLstRes struct {
	*api.PageLstRes[*mymodel.ClusterServerResponse] // 直接使用实体作为响应
}

type ClusterServerAddReq struct {
	g.Meta            `method:"post" path:"/cluster/server" summary:"新增集群服务器" tags:"集群服务器"`
	Name              string `v:"required#服务器名称不能为空" json:"name" dc:"服务器名称"`
	ServerKey         string `v:"required#服务器唯一标识不能为空" json:"serverKey" dc:"服务器唯一标识"`
	Remark            string `json:"remark" dc:"备注"`
	PublicIp          string `json:"publicIp" dc:"公网ip"`
	InnerIp           string `json:"innerIp" dc:"内网ip"`
	TotalDataDiskSize int64  `json:"totalDataDiskSize" dc:"数据盘总存储大小MB"`
	DataDiskPath      string `json:"dataDiskPath" dc:"数据盘的路径"`
	WebPort           int    `v:"required#web服务端口不能为空" json:"webPort" dc:"web服务端口"`
}

type ClusterServerAddRes struct{}

type ClusterServerUptReq struct {
	g.Meta            `method:"put" path:"/cluster/server/{id}" summary:"更新集群服务器" tags:"集群服务器"`
	Id                int    `v:"min:1#服务器ID必须" path:"id"`
	Name              string `v:"required#服务器名称不能为空" json:"name" dc:"服务器名称"`
	ServerKey         string `v:"required#服务器唯一标识不能为空" json:"serverKey" dc:"服务器唯一标识"`
	Remark            string `json:"remark" dc:"备注"`
	PublicIp          string `json:"publicIp" dc:"公网ip"`
	InnerIp           string `json:"innerIp" dc:"内网ip"`
	TotalDataDiskSize int64  `json:"totalDataDiskSize" dc:"数据盘总存储大小MB"`
	DataDiskPath      string `json:"dataDiskPath" dc:"数据盘的路径"`
	WebPort           int    `v:"required#web服务端口不能为空" json:"webPort" dc:"web服务端口"`
}

type ClusterServerUptRes struct{}

type ClusterServerDelReq struct {
	g.Meta `method:"delete" path:"/cluster/server/{id}" summary:"删除集群服务器" tags:"集群服务器"`
	Id     int `v:"min:1#服务器ID必须" path:"id"`
}

type ClusterServerDelRes struct{}

type ClusterServerGetOneReq struct {
	g.Meta `method:"get" path:"/cluster/server/getOne" summary:"获取一条" tags:"集群服务器"`
	Id     int `v:"min:1#服务器ID必须" path:"id"`
}

type ClusterServerGetOneRes struct {
	Info *entity.AppClusterServer `json:"info"`
}

type ClusterServerGetOptionsReq struct {
	g.Meta     `method:"get" path:"/cluster/server/getOptions" summary:"获取服务器选项" tags:"集群服务器"`
	FieldKey   string `json:"fieldKey"`   //明确指出key的字段
	FieldLabel string `json:"fieldLabel"` //明确指出label的字段
}

type ClusterServerGetOptionsRes struct {
	Options []*api.FormOptionsItem `json:"options"`
}

type ClusterServerGetClusterKeysReq struct {
	g.Meta `method:"get" path:"/cluster/server/getClusterKeys" summary:"获取所有集群标识" tags:"集群服务器"`
	DeptId uint64 `json:"deptId"`
	Type   string `v:"required#type不能为空" json:"type"` //那种服务类型
}

type ClusterServerGetClusterKeysRes struct {
	Options []*api.FormOptionsItem `json:"options"`
}
